import request from '../utils/request'

//获取推荐商品列表
export const getRecommendListApi = async (params) => {
    return await request.get('/api/products', {params})
}

//发布商品
export const publishProductApi = async (data) => {
    return await request.post('/api/products', data)
}

// 获取商品详情
export const getProductDetailApi = (id) => {
    return request.get(`/api/products/${id}`)
}

// 更新商品库存
export const updateProductStockApi = (id, stock) => {
    return request.put(`/api/products/${id}`, {
        stock
    })
}

// 创建订单
export const createOrderApi = (orderData) => {
    return request.post('/api/orders', orderData)
}